package com.String;

import java.util.Scanner;

/*
判断用户登录是否成功
*/
public class Deno09 {
    public static void main(String[] args) {
        int count = 0;
        while (true) {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入账号：");
            String userName = sc.next();
            System.out.println("请输入密码：");
            String password = sc.next();
            count++;
            if (userName.equals("itcase") && password.equals("123") || userName.equals("itheima") && password.equals("123")) {
                System.out.println("欢迎进入系统！！！");
                break;
            }
            if (count == 3) {
                System.out.println("机会用完了，请联系管理员！");
                break;
            }
            System.out.println("密码或账号错误，请重新输入,还有" + (3 - count) + "次机会：");
        }
    }
}
